//
//  ZYCTourRecordMarkCell.m
//  ZDSC
//
//  Created by ZDTX on 2021/7/26.
//

#import "ZYCTourRecordMarkCell.h"
#import "ZYCTourRecordStatusModel.h"

@interface ZYCTourRecordMarkCell ()

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) UILabel *line;
@end

@implementation ZYCTourRecordMarkCell
- (void)setTitleString:(NSString *)titleString{
    _titleString = titleString;
    _titleLabel.text = titleString;
}

- (void)setContentString:(NSString *)contentString{
    _contentString = contentString;
    _statusLabel.text = contentString;
}

//巡堂状态（1：正常；2：迟到；3：取消；4：异常）
- (void)setClassStatus:(NSString *)classStatus{
    _classStatus = classStatus;
    if ([classStatus integerValue] == 1) {
        _statusLabel.text = @"正常";
        _statusLabel.textColor = HEX_RGB(@"#39A85B");
    }else if ([classStatus integerValue] == 2) {
        _statusLabel.text = @"迟到";
        _statusLabel.textColor = HEX_RGB(@"#EB9F28");
    }else if ([classStatus integerValue] == 3) {
        _statusLabel.text = @"取消";
        _statusLabel.textColor = HEX_RGB(@"#2B302D");
    }else if ([classStatus integerValue] == 4) {
        _statusLabel.text = @"异常";
        _statusLabel.textColor = HEX_RGB(@"#E93C06");
    }
    
}

- (void)setIsHid:(BOOL)isHid{
    _isHid = isHid;
    _arrowImageView.hidden = YES;
}
- (void)setModel:(ZYCTourRecordStatusModel *)model{
    _model = model;
    _statusLabel.text = model.title;
    _statusLabel.textColor = model.textColor;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self.contentView addSubview:self.titleLabel];
        [self.contentView addSubview:self.statusLabel];
        [self.contentView addSubview:self.arrowImageView];
        [self.contentView addSubview:self.line];

        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView).offset(14.0f);
            make.centerY.equalTo(self.contentView);
        }];

        [self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.titleLabel.mas_right).offset(14.0f);
            make.centerY.equalTo(self.contentView);
        }];
        
        [self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView).offset(-14.0f);
            make.centerY.equalTo(self.contentView);
            make.size.mas_equalTo(CGSizeMake(13.0f, 8.0f));
        }];
        
    }
    return self;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [UILabel LabelWithString:@"选择标签:" Font:kCustomFont(@"PingFangSC-Light", 16.0f) titleColor:HEX_RGB(@"#999999") textAlignment:ZZTextAlignmentLeft];
    }
    return _titleLabel;
}

- (UIImageView *)arrowImageView {
    if (!_arrowImageView) {
        _arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"down"]];
    }
    return _arrowImageView;
}

- (UILabel *)statusLabel {
    if (!_statusLabel) {
        _statusLabel = [[UILabel alloc] init];
        _statusLabel.font = kCustomFont(@"PingFangSC-Light", 16.0f);
        _statusLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _statusLabel;
}




@end
